|
1
|
|
|
/* |
|
2
|
|
|
* Circles - Bring cloud-users closer together. |
|
3
|
|
|
* |
|
4
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
5
|
|
|
* later. See the COPYING file. |
|
6
|
|
|
* |
|
7
|
|
|
* @author Maxence Lange <[email protected]> |
|
8
|
|
|
* @copyright 2017 |
|
9
|
|
|
* @license GNU AGPL version 3 or any later version |
|
10
|
|
|
* |
|
11
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
12
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
13
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
14
|
|
|
* License, or (at your option) any later version. |
|
15
|
|
|
* |
|
16
|
|
|
* This program is distributed in the hope that it will be useful, |
|
17
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
19
|
|
|
* GNU Affero General Public License for more details. |
|
20
|
|
|
* |
|
21
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
22
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
23
|
|
|
* |
|
24
|
|
|
*/ |
|
25
|
|
|
|
|
26
|
|
|
/** global: OC */ |
|
27
|
|
|
/** global: OCA */ |
|
28
|
|
|
/** global: Notyf */ |
|
29
|
|
|
|
|
30
|
|
|
/** global: actions */ |
|
31
|
|
|
/** global: nav */ |
|
32
|
|
|
/** global: elements */ |
|
33
|
|
|
/** global: curr */ |
|
34
|
|
|
/** global: api */ |
|
35
|
|
|
|
|
36
|
|
|
|
|
37
|
|
|
var resultLinks = { |
|
38
|
|
|
|
|
39
|
|
|
|
|
40
|
|
|
linkCircleResult: function (result) { |
|
41
|
|
|
|
|
42
|
|
|
if (result.status !== 1) { |
|
43
|
|
|
OCA.notification.onFail( |
|
44
|
|
|
t('circles', "A link to <b>{remote}</b> could not be initiated", { |
|
45
|
|
|
remote: result.remote |
|
46
|
|
|
}) + ': ' + |
|
47
|
|
|
((result.error) ? result.error : t('circles', 'no error message'))); |
|
48
|
|
|
return; |
|
49
|
|
|
} |
|
50
|
|
|
|
|
51
|
|
|
if (result.link.status === define.linkRequestSent) { |
|
|
|
|
|
|
52
|
|
|
OCA.notification.onSuccess( |
|
53
|
|
|
t('circles', "A link to <b>{remote}</b> has been requested.", { |
|
54
|
|
|
remote: result.remote |
|
55
|
|
|
})); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
if (result.link.status === define.linkUp) { |
|
59
|
|
|
OCA.notification.onSuccess( |
|
60
|
|
|
t('circles', "the link to <b>{remote}</b> is now up and running.", { |
|
61
|
|
|
remote: result.remote |
|
62
|
|
|
})); |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
curr.circleLinks = result.links; |
|
66
|
|
|
nav.displayLinks(''); |
|
67
|
|
|
}, |
|
68
|
|
|
|
|
69
|
|
|
|
|
70
|
|
|
linkStatusResult: function (result) { |
|
71
|
|
|
|
|
72
|
|
|
if (result.status !== 1) { |
|
73
|
|
|
OCA.notification.onFail( |
|
74
|
|
|
t('circles', "The status of the link could not be updated") + ': ' + |
|
75
|
|
|
((result.error) ? result.error : t('circles', 'no error message'))); |
|
76
|
|
|
} else { |
|
77
|
|
|
OCA.notification.onSuccess(t('circles', "The status of the link has been updated")); |
|
78
|
|
|
curr.circleLinks = result.links; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
nav.displayLinks(''); |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
|
|
85
|
|
|
} |
|
86
|
|
|
; |
|
87
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.